const webpack = require("webpack");
module.exports = {
  publicPath: "./",
  css: {
    loaderOptions: {
      less: {},
    },
  },
  chainWebpack: config => {
    config.plugin("html").tap(args => {
      args[0].title = "上海图书馆近代图书知识库";
      return args;
    });
  },
  configureWebpack: {
    plugins: [
      new webpack.ProvidePlugin({
        $: "jquery",
        jQuery: "jquery",
        "windows.jQuery": "jquery",
      }),
    ],
  },
  // icon设置
  pwa: {
    iconPaths: {
      favicon32: "favicon.png",
      favicon16: "favicon.png",
      appleTouchIcon: "favicon.png",
      maskIcon: "favicon.png",
      msTileImage: "favicon.png",
    },
  },
  devServer: {
    port: 80,
    historyApiFallback: true,
    // 配置跨域代理 chens 20240327
    proxy: {
      "/mgts/mgts/instance": {
        target: "https://jdts.library.sh.cn",
        changeOrigin: true,
      },
      "/mgts/mgts/instance/search": {
        target: "https://jdts.library.sh.cn",
        changeOrigin: true,
      },
      "/report/api/queryinfo": {
        target: "https://www.cnbksy.com",
        changeOrigin: true,
      },
      "/report/api/previewinfo": {
        target: "https://www.cnbksy.com",
        changeOrigin: true,
      },
      "/management/webapi/cenofmagent/token/account": {
        target:
          "https://dhapi.library.sh.cn",
        changeOrigin: true,
      },
      "/jdts/downloadAsk": {
        target: "https://www.cnbksy.com",
        changeOrigin: true,
      },
      "/jdts/validCode": {
        target: "https://www.cnbksy.com",
        changeOrigin: true,
      },
      "/mgts/mgts/work": {
        target: "https://jdts.library.sh.cn",
        changeOrigin: true,
      },
    },
  },
};
